<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <style>
        .red{
            background: red;
        }

        .yellow{
            background: yellow;
        }
        .aa{

        }
        .bb{

        }
        .cc{

        }
    </style>
</head>
<body>
    <div id="box">
        <!-- class -->
      <div :class="classobj">动态切换class-对象写法</div>
      <div class="classarr">动态切换class-数组写法</div>

      <div style="background-color: red">静态行内样式</div>
      <div :style="styleobj">动态切换style-对象写法</div>
      <div :style="stylearr">动态切换style-数组写法</div>
    </div>


    <script>
       var vm = new Vue ({
           el:"#box",
           data: {
               classobj: {
                    aa: true,
                    bb: true,
                    cc: true,
               }, 
               classarr:['aa', 'bb', 'cc'],
               styleobj:{
                   backgroundColor:"red"
               }, 
               stylearr:[{
                   backgroundColor:"red"
               }]
           }
       })

       //给class对象动态切换属性：Vue.set(vm.classobj, "dd", true) 通过set进行拦截
       //给style对象动态切换属性： Vue.set(vm.styleobj, "fontSize", "40px") 通过set进行拦截
    </script>
</body>
</html>